GenLabs Platform: Agent Configuration and Usage Guide
This guide provides a comprehensive overview of configuring and using AI agents on the GenLabs platform.
Agent Details Page
This page, accessed by clicking a agent's name on the dashboard, allows fine-tuning of its behavior.
Editing Agent Settings
- Agent Name: A descriptive name for your agent.
- Agent Script: The core logic (Python) defining your agent's behavior. Click "Edit
Script" to access the editor.
- Key Functions:
query(model_name, conversation)
: Executes a query against a specified AI model with the current conversation history.add(role, content, conversation)
: Adds a new message (user, assistant, or system) to the conversation.attach(content, conversation, location="end")
: Attaches content to the beginning or end of the last message in the conversation.
- Example Scripts:
-
Chain of Thought Prompting:
initial_response = query("gpt-4o", conversation) follow_up = add("user", f"Explain your reasoning for that", conversation) final_response = query("gpt-4", conversation)
-
Model Switching Based on Conversation Length:
if len(conversation) > 10: response = query("gemini-1.5-flash-latest", conversation) # Use a faster, less expensive model for large conversations else: response = query("gpt-4", conversation) # More powerful model
-
- Key Functions:
- Plan:
- Decentralized: Lower cost, inference powered by the Decentralized Hub. Reliability may vary. Region selection is not available.
- Dedicated: Higher cost, dedicated resources for more reliable and consistent performance. Region selection is availible, but some regions may not have 100% uptime (will default to availible region).
- Top P: (Dedicated only) Controls the range of tokens considered by the agent when generating a response. A lower value makes the response more focused and deterministic, while a higher value allows for more diverse and creative outputs.
- Temperature: (Dedicated only) Influences the randomness of the agent's output. Lower values (closer to 0) result in more predictable and conservative responses, while higher values (closer to 1) encourage more creative and unexpected outputs.
- Region: (Dedicated only) Choose the geographical region for agent deployment.
- API Key: Select the API key for authenticating requests to your agent. Create new keys on the Trust Keys page.
- System Message: Sets the initial context for the agent. This message is prepended to every conversation.
- Stream: Configure the agent to return a response stream. Note that the decentralized plan may not always support streaming. The response will be set as one chunk of the entire conversation in the case streaming is not supported.
- Agent ID: A unique identifier for your agent.
- Try in Playground: Opens the Playground for interactive testing.
- Attach Tools: Integrate external tools (see below).
- Save Changes: Saves your agent configuration.
Available Models
The following table lists the available models, their availability (Decentralized, Dedicated, or Both), and their price in credits for each plan. Prices are estimates and may vary.
Model | Availability | Decentralized Price | Input Price | Output Price |
---|---|---|---|---|
gpt-4 |
Both | 20000 | 30000 | 60000 |
gpt-4-turbo |
Both | 10000 | 10000 | 30000 |
gpt-4o |
Both | 1000 | 2500 | 10000 |
gpt-4o-mini |
Both | 50 | 150 | 600 |
gemini-pro |
Both | 100 | 75 | 300 |
gemini-1.0-pro |
Both | 100 | 75 | 300 |
gemini-1.5-pro-latest |
Both | 1000 | 1250 | 5000 |
gemini-1.5-flash-latest |
Both | 50 | 75 | 300 |
gemini-2.0-flash |
Both | 0 | 100 | 400 |
gemini-2.0-flash-thinking-exp |
Both | 0 | 100 | 100 |
gemini-2.0-pro-exp |
Both | 0 | 100 | 100 |
gemini-2.0-flash-lite-preview |
Both | 0 | 100 | 100 |
gemini-exp-1206 |
Both | 0 | 100 | 100 |
learnlm-1.5-pro-experimental |
Both | 0 | 100 | 100 |
gemini-flash-1.5-8b |
Both | 0 | 100 | 100 |
gemma-2-9b-it |
Both | 0 | 100 | 100 |
llama-3.1-8b-instruct |
Both | 10 | 30 | 60 |
llama-3.2-11b-vision-instruct |
Both | 40 | 55 | 55 |
llama-3-405b |
Both | 100 | 200 | 200 |
dolphin3.0-r1-mistral-24b |
Both | 0 | 100 | 100 |
dolphin3.0-mistral-24b |
Both | 0 | 100 | 100 |
qwen-vl-plus |
Both | 0 | 100 | 100 |
qwen2.5-vl-72b-instruct |
Both | 0 | 100 | 100 |
mistral-small-24b-instruct-2501 |
Both | 0 | 70 | 140 |
deepseek-r1-distill-llama-70b |
Both | 0 | 230 | 690 |
deepseek-r1 |
Both | 0 | 80 | 240 |
rogue-rose-103b-v0.2 |
Both | 0 | 100 | 100 |
deepseek-v3 |
Both | 0 | 90 | 90 |
llama-3.3-70b-instruct |
Both | 0 | 120 | 30 |
llama-3.1-nemotron-70b-instruct |
Both | 0 | 120 | 30 |
mistral-nemo |
Both | 0 | 35 | 8 |
mistral-7b-instruct |
Both | 0 | 100 | 100 |
phi-3-mini-128k-instruct |
Both | 0 | 100 | 100 |
phi-3-medium-128k-instruct |
Both | 0 | 100 | 100 |
llama-3-8b-instruct |
Both | 0 | 100 | 100 |
openchat-7b |
Both | 0 | 100 | 100 |
toppy-m-7b |
Both | 0 | 100 | 100 |
zephyr-7b-beta |
Both | 0 | 100 | 100 |
mythomax-l2-13b |
Both | 0 | 100 | 100 |
*If you are using the API to create models, use -latest when running on decentralized, use without -latest on dedicated.
Rate Limits
The following table outlines the rate limits for different tiers:
Tier | Requests per Minute | Requests per Day | Credit Range |
---|---|---|---|
Tier 1 | 10 | 500 | 10,000 credits or less |
Tier 2 | 60 | 5000 | 10,000 - 50,000 credits |
Tier 3 | 60 | 10000 | 50,000 - 100,000 credits |
Tier 4 | 120 | 50000 | 100,000 - 500,000 credits |
Tier 5 | 240 | 100000 | 500,000+ credits |
Note that if you fall under any tier limit, you will lose access to the higher tier rate limits. For example, if you are in Tier 2, and you credits fall below 10000, you will be downgraded to Tier 1. To continue using the higher rate limits , buy more credits.
Prompt/Response data for models on tier 1 may be used to improve respective owner's services
How pricing is caluclated:
-
CPHQ = credits per hundred queries. H
-
/MTok = credits per million tokens.
-
10 credits are 1 cent.
Tool calls aren't billed. Decentralized models are billed per request, while dedicated models are billed per tokens. You may have a special offer that lowers the price of decentralized models.
Agent Usage
- Requests: Number of requests made to the agent.
- Credits: Credits consumed by the agent.
Playground
The Playground allows you to interactively test your agent.
- Endpoint URL: The URL for making API requests to your agent.
- Conversation Builder:
- Add "user" and "assistant" messages to simulate a conversation.
- Edit the content within each message to craft specific prompts and responses.
- If you haven't set a default system message, you can set one here
- Headers: You'll need to paste the API key into the
Authorization
header. Ensure your API key is correct. - Run: Sends the constructed conversation to your agent for processing.
- Show Code: Generates code snippets in various programming languages (Python, JavaScript, cURL, etc.) demonstrating how to make API calls to your agent with the current conversation. This simplifies integration into your applications.
- Playground Output: Displays the raw JSON response from your agent.
Attaching Tools
Tools extend the capabilities of your agents by allowing them to interact with external services and data. Examples of tools might include:
- Search Engines: Access real-time information.
- Calculators: Perform mathematical operations.
- Code Execution: Run code snippets.
- Database Access: Retrieve data from databases.
- APIs: Connect to external APIs.
The "Attach Tools" section lets you manage which tools are available to your agent. You can create these tools here.
When you receive a tool call, you can make an API request to another application, or make a request to your database.
User: Can you tell me when my order arrives?
Assistant: Called tool: Get delivery date. Got: 2/3/2024
Aditionally, if you want to generate a response in a user-friendly manner, you can add:
User: Generate a final response in a user friendly manner.
Assistant: Your order will arrive on February 2nd, 2024.
Then on the next call, truncate the process into one step:
User: Can you tell me when my order arrives?
Assistant: Called tool: Get delivery date. Got: 2/3/2024 Your order will arrive on February 2nd, 2024.
OR:
User: Can you tell me when my order arrives?
Assistant: Called tool: Get delivery date. Got: 2/3/2024 Your order will arrive on February 2nd, 2024.
Managing Trust Keys and Agreements
The GenLabs Platform uses API keys for authentication and requires acceptance of trust agreements for certain features. This section explains how to manage your API keys and view your agreements.
API Keys (Trust Keys)
API keys are used to authenticate requests to your agents. You can manage your API keys on the Trust Keys page
Viewing Your Keys:
The Keys page displays a table of your existing API keys, including their name, creation date, last used date, and the actual key value (only shown once before first use).
Creating a New Key:
- Click the button.
- Enter a descriptive name for your key in the modal.
- Click . Important: Copy the generated API key immediately. You won't be able to view it again after the modal closes.
Deleting a Key:
Click the button next to the key you want to remove. This action is irreversible.
Key Security:
- Treat your API keys like passwords. Do not share them publicly or expose them in client-side code.
- If a key is compromised, delete it immediately and create a new one.
- Use descriptive key names to help you manage multiple keys.
Trust Agreements
Certain features, such as decentralized agent deployment, require you to accept trust agreements. You can view your accepted agreements on the Trust/Agreements page.
Viewing Agreements:
The Agreements page displays a table of your accepted agreements, including their name and the date you accepted them. Clicking "View" next to an agreement will show the full text of the agreement.
Accepting Agreements:
Agreements are typically presented and accepted during specific actions, such as creating a decentralized model. You'll be prompted to read and accept the agreement before proceeding. Once accepted, the agreement will appear on the Agreements page.
Types of Agreements:
- Decentralized Inference Agreement: Acknowledges the risks and responsibilities associated with using decentralized inference.
Logs Page
The Logs page provides a detailed view of your agent's usage history. You can access this page by clicking the "View Detailed Statistics" button on the Agent Details page.
Features
- Agent Filter: Filter logs by a specific agent.
- Search: Search logs by agent name or prompt content.
- Sortable Columns: Sort logs by agent name, timestamp, credits used, or response time.
- Pagination: Navigate through logs using pagination controls.
- Detailed Log View: Click the button to see the full prompt, response, and metrics for a specific log entry.
Log Details Modal
When you click the button for a log entry, a modal will appear with the following information:
- Agent Name: The name of the agent used for the request.
- Timestamp: The date and time of the request.
- Prompt: The full prompt sent to the model.
- Response: The full response received from the model.
- Metrics:
- Response Time: The time taken for the model to generate a response.
- Tool Call Time: The time taken to figure out which tool to call, if any.
- Tool Parameterization Time: The time taken to attach parameters to a tool call.
Log Data
The logs table displays the following information for each log entry:
- Agent Name: The name of the agent used for the request.
- Timestamp: The date and time of the request.
- Credits: The number of credits consumed by the request.
- Response Time: The time taken for the model to generate a response.
- Tool Usage: Indicates if a tool was used and the time taken for the tool call.
- Prompt: A preview of the prompt sent to the model.
- View: A button to view the full log details.
Session Maps Beta
The Logs page also includes a session map, which displays the agent's activity over time. This map provides a visual representation of the agents conversation
GenLabs Query Agent Documentation
Table of Contents
- Introduction
- Authentication
- API Versions
- Transactional API
- Threaded API
- Tool Integration
- File Search Capabilities
- Response Formats
- Advanced Features
- Use Cases & Examples
- Best Practices
- Troubleshooting
Introduction
GenLabs Agents provide a powerful interface for AI-driven conversations with built-in support for tool execution and document analysis. The platform offers two distinct API approaches: Transactional and Threaded, each optimized for different use cases.
Authentication
Every request requires an API key in the headers:
headers: {
'Authorization': 'your-api-key-here'
}
Note: There is no "Bearer" prefix in the header.
API Versions
Version 1 (Transactional)
- Endpoint:
https://genlabsapi.onrender.com/v1/{agent_id}
- Requires full conversation history
- Stateless operations
Version 2 (Threaded) BETA
Logging must be turned on for your agent to use this API.
- Endpoint:
https://genlabsapi.onrender.com/v2/{agent_id}
- Maintains conversation state
- Only requires latest message
Transactional API
Basic Message Structure
{
"conversation": [
{
"role": "system",
"content": "You are a helpful assistant specialized in customer service."
},
{
"role": "user",
"content": "I need help with my recent order."
},
{
"role": "assistant",
"content": "I'll be happy to help. Could you provide your order number?"
},
{
"role": "user",
"content": "Yes, it's ORDER-123456"
}
]
}
Context Management
The Transactional API gives you complete control over conversation context. Best practices include:
-
System Messages: Set the agent's behavior and capabilities
{ "role": "system", "content": "You are a technical support specialist with expertise in cloud computing." }
-
Relevant History: Include previous messages that provide context
{ "role": "user", "content": "My EC2 instance keeps crashing" }, { "role": "assistant", "content": "What's the instance type and OS?" }, { "role": "user", "content": "t2.micro running Ubuntu 20.04" }
-
State Management: Track important details in conversation
{ "role": "assistant", "content": "Based on your t2.micro instance running Ubuntu 20.04, let's check the system logs." }
Threaded API
The threaded API is similar to OpenAI's "Assistants" API. It maintains conversation state and requires only the latest message. This is ideal for long-running conversations.
Single Message Format
{
"message": {
"role": "user",
"content": "Check the status of my order"
}
}
Session Management
Include a unique session ID (for each conversation) in headers for consistent threading:
headers: {
'Authorization': 'your-api-key-here',
'session': 'unique-session-id'
}
Conversation Flow Examples
-
Initial Query:
{ "message": { "role": "user", "content": "I need to check my order status" } }
-
Follow-up:
{ "message": { "role": "user", "content": "The order number is ORD-789" } }
Tool Integration
Available Tool Types
- File Search Tools
- Custom Function Tools
Tool Call Examples
-
Order Lookup:
{ "message": { "role": "user", "content": "Get the details for order #12345" } }
Response:
{ "status": "success", "message": "Tool call(s) initiated", "tool_calls": [ { "name": "tool_name", "parameters": {{ "param1": "value1" "param2": "value2" }} } ] } // Or, in the case of a question... { "status": "success", "message": "Tool call(s) initiated", "tool_calls": [ { "name": "tool_name", "question": "Could you please tell me your order number?" } ] }
-
Customer Update:
{ "message": { "role": "user", "content": "Update shipping address for customer ID 789 to 123 Main St, Boston, MA" } }
Parameter Handling
The agent intelligently handles missing parameters:
{
"status": "success",
"message": "Tool call(s) initiated",
"tool_calls": [
{
"name": "tool_name",
"question": "Sure! Could you please enter your phone number?"
}
]
}
File Search Capabilities
Supported File Types
- PDF Documents
- HTML Content
- Word Documents (.doc, .docx)
- Plain Text
Search Implementation
-
Basic Document Query:
{ "message": { "role": "user", "content": "Find information about refunds in the terms of service" } }
-
Specific Section Search:
{ "message": { "role": "user", "content": "What does section 3.2 of the contract say about liability*?" } }
-
Multi-Document Analysis:
{ "message": { "role": "user", "content": "Compare the payment terms between the old and new contracts" } }
File Search Response Format
{
"status": "success",
"data": {
"file_searches": ["Contract_Search", "Terms_Search"],
"response": "Based on the documents, the payment terms have changed in the following ways..."
}
}
*Generative AI shouldn't be used for legal or financial advice. This is for demonstration purposes only.
Advanced Features
Tool Chaining
Combine multiple tools in sequence:
{
"message": {
"role": "user",
"content": "Find all orders from customer 123 and update their status to shipped"
}
}
Context Awareness
You can feed the responses back into the agent (currently v1 API only) to maintain context:
{
"message": {
"role": "user",
"content": "What was the total value of those orders?"
}
}
Use Cases & Examples
Customer Service Portal
-
Order Management:
{ "conversation": [ { "role": "system", "content": "You are a customer service agent for a retail company. You are chatting with John Doe (email: [email protected])" }, { "role": "user", "content": "Find all pending orders for me" } ] }
-
Issue Resolution:
{ "message": { "role": "user", "content": "Create a return request for order #12345 with reason 'defective product'" } }
You could make a tool called "Create Return request" that would create a return request for the given order number
and reason.
Data Operations
-
Inventory Management:
{ "message": { "role": "user", "content": "Check stock levels for SKU-789 across all warehouses" } }
You could create a tool called "Check Inventory" that would return the stock levels for the given SKU across all
warehouses.
-
Report Generation:
{ "message": { "role": "user", "content": "Generate a summary of all transactions from March 2024" } }
You could create a file search tool to search for all transactions from a certain date range.
Best Practices
1. Conversation Management
- Keep system messages clear and specific
- Include relevant context only
- Use consistent session IDs for threaded conversations
2. Tool Usage
- Provide complete parameters when possible
- Handle follow-up questions gracefully
- Validate tool responses
3. File Searches
- Use specific queries for better results
- Reference document sections when known
- Consider document context in follow-up questions
4. Error Handling
- Implement retry logic for failed requests
- Handle rate limits appropriately
- Log important operations
Troubleshooting
Common Issues
-
Authentication Errors
- Verify API key is valid
- Check key permissions
- Ensure proper header format
-
Tool Execution Failures
- Verify parameter completeness
- Check tool availability
- Review error messages
-
File Search Issues
- Confirm file accessibility
- Verify file format support
- Check search query specificity
Performance Optimization
-
Response Time
- Use streaming for long operations
- Optimize conversation history length
- Implement proper caching
-
Resource Usage
- Monitor credit consumption
- Track tool usage patterns
- Optimize file search queries
Agent API Documentation
Important: The following endpoints require a "Secret" API key.
POST /create_agent
Creates a new agent associated with a user.
Request
Method: POST
URL: /create_agent
Headers:
Content-Type: application/json
Body:
{
"session_id": "string", // Optional: User's session ID for authentication
"api_key": "string", // Optional: User's API key for authentication
"agent_name": "string", // Required: Name of the agent to be created
"plan": "string", // Required: Plan for the agent ('Decentralized' or 'Dedicated')
"region": "string" // Required if plan is 'Dedicated': Region for the agent (e.g., 'us-east-1', 'us-west-1', 'eu-west-1')
}
Authentication:
This endpoint supports two methods of authentication:
- Session ID: If a
session_id
is provided, the server will validate it against the database. - API Key: If a
session_id
is not provided, the server will attempt to authenticate using the providedapi_key
. The API key must be a valid key associated with a user
Request Body Parameters:
session_id
(string, optional): The session ID of the user. Use this for session-based authentication.api_key
(string, optional): The API key of the user. Use this for API key-based authentication.agent_name
(string, required): The name you want to give to the new agent.plan
(string, required): The plan for the agent. Must be eitherDecentralized
orDedicated
.region
(string, required ifplan
isDedicated
): The region where the agent will be hosted. Must be one of the valid regions defined in the server configuration (e.g.,us-east-1
,us-west-1
,eu-west-1
).
Response
Success Response (201 Created):
{
"message": "Agent created successfully"
}
Error Responses:
-
400 Bad Request:
- Returned if
agent_name
orplan
are missing. - Returned if
plan
is notDecentralized
orDedicated
. - Returned if
region
is missing or invalid whenplan
isDedicated
.
{ "error": "Agent name and plan are required" }
{ "error": "Invalid plan selection" }
{ "error": "Invalid region selection" }
- Returned if
-
401 Unauthorized:
- Returned if the provided
session_id
orapi_key
is invalid or missing.
{ "error": "Not authenticated, invalid session id or api key" }
- Returned if the provided
-
500 Internal Server Error:
- Returned if there is a server-side error during agent creation.
{ "error": "Failed to create model" }
Request
Using API Key:
{
"api_key": "any_one_of_your_keys",
"agent_name": "My New Agent",
"plan": "Dedicated",
"region": "us-east-1"
}
Notes
- The
region
parameter is only required when theplan
is set toDedicated
. - Ensure that the user has the necessary permissions to create a agent.
DELETE /delete_agent
Deletes an existing agent associated with a user.
Request
Method: DELETE
URL: /delete_agent
Headers:
Content-Type: application/json
Body:
{
"session_id": "string", // Optional: User's session ID for authentication
"api_key": "string", // Optional: User's API key for authentication
"agent_id": "string" // Required: ID of the agent to be deleted
}
Authentication
This endpoint supports two methods of authentication:
- Session ID: If a
session_id
is provided, the server will validate it against the database. - API Key: If a
session_id
is not provided or is invalid, the server will attempt to authenticate using the providedapi_key
. The API key must be a valid key associated with a user
- Note: If both
session_id
andapi_key
are provided,session_id
takes precedence.
Request Body Parameters
session_id
(string, optional): The session ID of the user. Use this for session-based authentication.api_key
(string, optional): The API key of the user. Use this for API key-based authentication.agent_id
(string, required): The ID of the agent to be deleted.
Response
Success Response (200 OK):
{
"message": "Agent deleted successfully"
}
Error Responses:
-
400 Bad Request:
- Returned if
agent_id
is missing.
{ "error": "Model ID is required" }
- Returned if
-
401 Unauthorized:
- Returned if the provided
session_id
orapi_key
is invalid or missing.
{ "error": "Not authenticated, invalid session id or api key" }
- Returned if the provided
-
404 Not Found:
- Returned if the model does not exist or does not belong to the authenticated user.
{ "error": "Model not found or does not belong to you" }
-
500 Internal Server Error:
- Returned if there is a server-side error during model deletion.
{ "error": "Failed to delete model" }
Example Request
Using Session ID:
{
"session_id": "user-session-id",
"model_id": "model-uuid"
}
Using API Key:
{
"api_key": "user-api-key",
"model_id": "model-uuid"
}
- Note: The client can provide either
session_id
orapi_key
along with themodel_id
. If both are provided,session_id
takes precedence.
Notes
- Ownership Verification: Ensures that only the owner of a model can delete it, maintaining data security and integrity.
- Security Measures:
- Utilizes parameterized SQL queries to prevent SQL injection attacks.
- Does not expose sensitive information in error responses.
- Logging: Implements detailed logging for exceptions, facilitating easier debugging and monitoring without exposing sensitive data to end-users.
- Database Schema Integrity: Ensure that the database schema enforces the relationship between users and their models to prevent unauthorized access or data leaks.
- Environment Configuration: Verify that all necessary environment variables, such as database credentials and API keys, are correctly set and managed securely.
POST /get_agent_details
Retrieves detailed information about a specific model associated with a user.
Request
Method: POST
URL: /get_agent_details
Headers:
Content-Type: application/json
Body:
{
"session_id": "string", // Optional: User's session ID for authentication
"api_key": "string", // Optional: User's API key for authentication
"modelId": "string" // Required: ID of the model to retrieve details for
}
Authentication
This endpoint supports two methods of authentication:
- Session ID: If a
session_id
is provided, the server will validate it against the database. - API Key: If a
session_id
is not provided or is invalid, the server will attempt to authenticate using the providedapi_key
. The API key must be a valid key associated with a user
- Note: If both
session_id
andapi_key
are provided,session_id
takes precedence.
Request Body Parameters
session_id
(string, optional): The session ID of the user. Use this for session-based authentication.api_key
(string, optional): The API key of the user. Use this for API key-based authentication.modelId
(string, required): The ID of the model to retrieve details for.
Response
Success Response (200 OK):
{
"modelName": "string",
"creationDate": "YYYY-MM-DD HH:MM:SS",
"modelScript": "string",
"plan": "string",
"region": "string",
"apiKey": "string",
"tools": "string",
"topP": "float",
"temperature": "float",
"system": "string",
"stream": "boolean"
}
Error Responses:
-
400 Bad Request:
- Returned if
modelId
is missing.
{ "error": "Model ID is required" }
- Returned if
-
401 Unauthorized:
- Returned if the provided
session_id
orapi_key
is invalid or missing.
{ "error": "Not authenticated, invalid session ID or API key" }
- Returned if the provided
-
404 Not Found:
- Returned if the model does not exist or does not belong to the authenticated user.
{ "error": "Model not found" }
-
500 Internal Server Error:
- Returned if there is a server-side error while fetching model details.
{ "error": "Failed to fetch model details" }
Example Request
Using Session ID:
{
"session_id": "user-session-id",
"modelId": "model-uuid"
}
Using API Key:
{
"api_key": "user-api-key",
"modelId": "model-uuid"
}
- Note: Clients can provide either
session_id
orapi_key
along with themodelId
. If both are provided,session_id
takes precedence.
Example Success Response
{
"modelName": "My Awesome Model",
"creationDate": "2023-10-01 12:00:00",
"modelType": null, //Legacy Field
"modelProvider": null, //Legacy Field
"modelScript": "print('Hello World')",
"plan": "Dedicated",
"region": "us-east-1",
"apiKey": "generated-api-key",
"tools": "Tool1, Tool2",
"topP": 0.9,
"temperature": 0.75,
"system": "System Configuration",
"stream": true
}
PUT /update_agent
Updates an existing model associated with a user.
Request
Method: PUT
URL: /update_agent
Headers:
Content-Type: application/json
Body:
{
"session_id": "string", // Optional: User's session ID for authentication
"api_key": "string", // Optional: User's API key for authentication
"modelId": "string", // Required: ID of the model to be updated
"modelName": "string", // Optional: New name for the model
"modelScript": "string", // Optional: New script for the model
"region": "string", // Optional: New region for the model
"plan": "string", // Optional: New plan for the model
"tools": ["string"], // Optional: New tools for the model
"topP": "float", // Optional: New top_p for the model
"apiKey": "string", // Optional: New api_key for the model
"temperature": "float", // Optional: New temperature for the model
"system": "string", // Optional: New system message for the model
"stream": "boolean" // Optional: New stream setting for the model
}
Authentication
This endpoint supports two methods of authentication:
- Session ID: If a
session_id
is provided, the server will validate it against the database. - API Key: If a
session_id
is not provided, the server will attempt to authenticate using the providedapi_key
. The API key must be a valid key associated with a user
Request Body Parameters:
session_id
(string, optional): The session ID of the user. Use this for session-based authentication.api_key
(string, optional): The API key of the user. Use this for API key-based authentication.modelId
(string, required): The ID of the model to be updated.modelName
(string, optional): The new name for the model.modelScript
(string, optional): The new script for the model. See Model Scripts.region
(string, optional): The new region for the model.plan
(string, optional): The new plan for the model.tools
(array of strings, optional): The new tools for the model.topP
(float, optional): The new top_p for the model.apiKey
(string, optional): The new api_key for the model.temperature
(float, optional): The new temperature for the model.system
(string, optional): The new system message for the model.stream
(boolean, optional): The new stream setting for the model.
Response
Success Response (200 OK):
{
"message": "Model updated successfully"
}
Error Responses:
-
400 Bad Request:
- Returned if
modelId
is missing.
{ "error": "Model ID is required" }
- Returned if
-
401 Unauthorized:
- Returned if the provided
session_id
orapi_key
is invalid or missing.
{ "error": "Not authenticated, invalid session id or api key" }
- Returned if the provided
-
500 Internal Server Error:
- Returned if there is a server-side error during model update.
{ "error": "Failed to update model" }
Example Request
Using API Key:
{
"api_key": "user-api-key",
"modelId": "model-uuid",
"modelScript": "print('Updated Script')",
"region": "us-west-1"
}
POST /create_tool
Creates a new tool associated with a user.
Request
Method: POST
URL: /create_tool
Headers:
Content-Type: application/json
Body:
{
"session_id": "string", # Optional: User's session ID for authentication
"api_key": "string", # Optional: User's API key for authentication
"name": "string", # Required: Name of the tool to be created
"description": "string", # Required: Description of the tool
"type": "string", # Required: Type of the tool ('File Search' or 'Custom')
"tool_schema": "object" # Optional: JSON schema for the tool parameters
}
Authentication:
This endpoint supports two methods of authentication:
- Session ID: If a
session_id
is provided, the server will validate it against the database. - API Key: If a
session_id
is not provided, the server will attempt to authenticate using the providedapi_key
. The API key must be a valid key associated with a user
Request Body Parameters:
session_id
(string, optional): The session ID of the user. Use this for session-based authentication.api_key
(string, optional): The API key of the user. Use this for API key-based authentication.name
(string, required): The name you want to give to the new tool.description
(string, required): A description of the tool.type
(string, required): The type of the tool. Must be eitherFile Search
orCustom
.tool_schema
(object, optional): A JSON schema defining the parameters for the tool.
Response
Success Response (201 Created):
{
"message": "Tool created successfully",
"tool_id": "integer"
}
Error Responses:
-
400 Bad Request:
- Returned if
name
,description
, ortype
are missing. - Returned if
name
,description
, ortype
are not strings. - Returned if
name
,description
, ortype
are empty strings.
{ "error": "Tool name, description, and type are required" }
{ "error": "Tool name, description, and type must be strings" }
{ "error": "Tool name, description, and type cannot be empty" }
- Returned if
-
401 Unauthorized:
- Returned if the provided
session_id
orapi_key
is invalid or missing.
{ "error": "Not authenticated, invalid session id or api key" }
- Returned if the provided
-
500 Internal Server Error:
- Returned if there is a server-side error during tool creation.
{ "error": "Failed to create tool" }
Example Request
Using API Key:
{
"api_key": "any_one_of_your_keys",
"name": "My New Tool",
"description": "A tool for doing things",
"type": "Custom",
"tool_schema": {
"type": "object",
"properties": {
"param1": { "type": "string" },
"param2": { "type": "integer" }
},
"required": ["param1"]
}
}
Notes
- The
tool_id
is generated by the server upon successful tool creation and is returned in the response. - The
tool_schema
parameter is optional. - Ensure that the user has the necessary permissions to create a tool.
POST /get_tools
Retrieves a list of tools associated with a user.
Request
Method: POST
URL: /get_tools
Headers:
Content-Type: application/json
Body:
{
"session_id": "string", // Optional: User's session ID for authentication
"api_key": "string" // Optional: User's API key for authentication
}
Authentication
This endpoint supports two methods of authentication:
- Session ID: If a
session_id
is provided, the server will validate it against the database. - API Key: If a
session_id
is not provided, the server will attempt to authenticate using the providedapi_key
. The API key must be a valid key associated with a user
Request Body Parameters:
session_id
(string, optional): The session ID of the user. Use this for session-based authentication.api_key
(string, optional): The API key of the user. Use this for API key-based authentication.
Response
Success Response (200 OK):
{
"tools": [
{
"id": "integer",
"name": "string",
"description": "string",
"type": "string",
"tool_schema": "object"
}
]
}
Error Responses:
-
401 Unauthorized:
- Returned if the provided
session_id
orapi_key
is invalid or missing.
{ "error": "Not authenticated, invalid session id or api key" }
- Returned if the provided
-
500 Internal Server Error:
- Returned if there is a server-side error while fetching tools.
{ "error": "Failed to fetch tools" }
Example Request
Using API Key:
{
"api_key": "any_one_of_your_keys"
}
Notes
- The response includes an array of tool objects, each containing the tool's
id
,name
,description
,type
, andtool_schema
. - Ensure that the user has the necessary permissions to retrieve tools.
DELETE /delete_tool/<int:tool_id>
Deletes an existing tool associated with a user.
Request
Method: DELETE
URL: /delete_tool/<int:tool_id>
Headers:
Content-Type: application/json
Body:
{
"session_id": "string", // Optional: User's session ID for authentication
"api_key": "string" // Optional: User's API key for authentication
}
Authentication
This endpoint supports two methods of authentication:
- Session ID: If a
session_id
is provided, the server will validate it against the database. - API Key: If a
session_id
is not provided, the server will attempt to authenticate using the providedapi_key
. The API key must be a valid key associated with a user
Request Body Parameters:
session_id
(string, optional): The session ID of the user. Use this for session-based authentication.api_key
(string, optional): The API key of the user. Use this for API key-based authentication.tool_id
(integer, required): The ID of the tool to be deleted, passed as part of the URL.
Response
Success Response (200 OK):
{
"message": "Tool deleted successfully"
}
Error Responses:
-
401 Unauthorized:
- Returned if the provided
session_id
orapi_key
is invalid or missing.
{ "error": "Not authenticated, invalid session id or api key" }
- Returned if the provided
-
404 Not Found:
- Returned if the tool does not exist or does not belong to the authenticated user.
{ "error": "Tool not found or unauthorized" }
-
500 Internal Server Error:
- Returned if there is a server-side error during tool deletion.
{ "error": "Failed to delete tool" }
Example Request
Using API Key:
{
"api_key": "any_one_of_your_keys"
}
Notes
- The
tool_id
is passed as part of the URL. - Ensure that the user has the necessary permissions to delete the tool.
PUT /update_tool
Updates an existing tool associated with a user.
Request
Method: PUT
URL: /update_tool
Headers:
Content-Type: application/json
Body:
{
"session_id": "string", // Optional: User's session ID for authentication
"api_key": "string", // Optional: User's API key for authentication
"toolId": "integer", // Required: ID of the tool to be updated
"toolName": "string", // Optional: New name for the tool
"toolDescription": "string", // Optional: New description for the tool
"type": "string", // Optional: New type for the tool
"parameters": [ // Optional: New parameters for the tool
{
"name": "string",
"type": "string",
"description": "string",
"required": "boolean"
}
],
"file": "string", // Optional: New file data for the tool (base64 encoded)
"tool_schema": "object" // Optional: New JSON schema for the tool
}
Authentication
This endpoint supports two methods of authentication:
- Session ID: If a
session_id
is provided, the server will validate it against the database. - API Key: If a
session_id
is not provided, the server will attempt to authenticate using the providedapi_key
. The API key must be a valid key associated with a user
Request Body Parameters:
session_id
(string, optional): The session ID of the user. Use this for session-based authentication.api_key
(string, optional): The API key of the user. Use this for API key-based authentication.toolId
(integer, required): The ID of the tool to be updated.toolName
(string, optional): The new name for the tool.toolDescription
(string, optional): The new description for the tool.type
(string, optional): The new type for the tool.parameters
(array of objects, optional): The new parameters for the tool.file
(string, optional): The new file data for the tool, base64 encoded.tool_schema
(object, optional): The new JSON schema for the tool.
Response
Success Response (200 OK):
{
"message": "Tool updated successfully"
}
Error Responses:
-
400 Bad Request:
- Returned if
toolId
is missing.
{ "error": "Tool ID is required" }
- Returned if
-
401 Unauthorized:
- Returned if the provided
session_id
orapi_key
is invalid or missing.
{ "error": "Not authenticated, invalid session id or api key" }
- Returned if the provided
-
500 Internal Server Error:
- Returned if there is a server-side error during tool update.
{ "error": "Failed to update tool" }
Example Request
Using API Key:
{
"api_key": "any_one_of_your_keys",
"toolId": 123,
"toolName": "Updated Tool Name",
"toolDescription": "An updated description",
"type": "Custom",
"parameters": [
{
"name": "param1",
"type": "string",
"description": "Parameter 1",
"required": true
}
],
"tool_schema": {
"type": "object",
"properties": {
"param1": { "type": "string" }
},
"required": ["param1"]
}
}
Notes
- The endpoint allows partial updates, meaning you only need to include the fields you want to change.
- The
toolId
is required to identify the tool to be updated. - Ensure that the user has the necessary permissions to update the tool.
POST /get_tool_details
Retrieves detailed information about a specific tool associated with a user.
Request
Method: POST
URL: /get_tool_details
Headers:
Content-Type: application/json
Body:
{
"session_id": "string", // Optional: User's session ID for authentication
"api_key": "string", // Optional: User's API key for authentication
"toolId": "integer" // Required: ID of the tool to retrieve details for
}
Authentication
This endpoint supports two methods of authentication:
- Session ID: If a
session_id
is provided, the server will validate it against the database. - API Key: If a
session_id
is not provided, the server will attempt to authenticate using the providedapi_key
. The API key must be a valid key associated with a user
Request Body Parameters:
session_id
(string, optional): The session ID of the user. Use this for session-based authentication.api_key
(string, optional): The API key of the user. Use this for API key-based authentication.toolId
(integer, required): The ID of the tool to retrieve details for.
Response
Success Response (200 OK):
{
"name": "string",
"description": "string",
"type": "string",
"file": "string",
"tool_schema": "object",
"parameters": [
{
"name": "string",
"type": "string",
"description": "string",
"required": "boolean"
}
]
}
Error Responses:
-
400 Bad Request:
- Returned if
toolId
is missing.
{ "error": "Tool ID is required" }
- Returned if
-
401 Unauthorized:
- Returned if the provided
session_id
orapi_key
is invalid or missing.
{ "error": "Not authenticated, invalid session id or api key" }
- Returned if the provided
-
404 Not Found:
- Returned if the tool does not exist or does not belong to the authenticated user.
{ "error": "Tool not found" }
-
500 Internal Server Error:
- Returned if there is a server-side error while fetching tool details.
{ "error": "Failed to get tool details" }
Example Request
Using API Key:
{
"api_key": "any_one_of_your_keys",
"toolId": 123
}
Notes
- The response includes the tool's
name
,description
,type
,file
(base64 encoded),tool_schema
, and an array ofparameters
. - Ensure that the user has the necessary permissions to retrieve tool details.
Support Chart
This chart provides an overview of the available functionalities
You can opt-in to try alpha features
OpenAI Functionality Support
Description | Decentralized | Dedicated | OpenAI |
---|---|---|---|
Text Generation | Yes | Yes | Yes |
Assistants | Yes | Yes | Yes |
Vision | No | Alpha | Yes |
Image Generation | Alpha | Alpha | Yes |